import { lazy } from "react";
import Home from '../path/home/Index'
import Login from '../path/login/Index'
import Error from '../path/404/Index'
import { createBrowserRouter, Navigate } from "react-router-dom";
let Order=lazy(()=>import('../path/order/Index'))
let User=lazy(()=>import('../path/user/Index'))
let My=lazy(()=>import('../path/my/Index'))
let Ok=lazy(()=>import('../path/ok/Index'))
// 三级
const Op=lazy(()=>import('../path/user/op/Index'))
export const menu_router=[
    {
        path:'/home/order',
        element:<Order></Order>,
        title:'订单管理'
    },
      {
        path:'/home/my',
        element:<My></My>,
        title:'个人中心'
    },
    {
        path:'/home/user',
        element:<User></User>,
        title:'用户管理',
        children:[
            {
                path:'/home/user/op',
                element:<Op></Op>,
                title:'用户操作'
            }
        ]
    }
]
const routes=createBrowserRouter([
{
    path:'/',
    element:<Navigate to={'/home'}></Navigate>
},
{
    path:'/home',
    element:<Home></Home>,
    children:menu_router
},
{
    path:'/login',
    element:<Login></Login>
},
{
    path:'/ok',
    element:<Ok></Ok>
},
{
    path:'*',
    element:<Error></Error>
}
])
export default routes;